package zhengfuzhe.com.newupload1.download;

/**
 * Created by Administrator on 2016/6/16 0016.
 * 作为一个枚举类，保存状态
 */
public enum DownloadState {
    WATING(0), STARTED(1), FINISH(2), STOPED(3), ERROR(4);
    private final int value;

    DownloadState(int value) {
        this.value = value;
    }

    public int value() {
        return value;
    }

    public static DownloadState valueOf(int value) {
        switch (value) {
            case 0:
                return WATING;//等待
            case 1:
                return STARTED;//开始
            case 2:
                return FINISH;//完成
            case 3:
                return STOPED;//停止
            case 4:
                return ERROR;//错误
            default:
                return STOPED;//停止
        }
    }


}
